<%@page import="com.mysql.fabric.xmlrpc.base.Data"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/common/taglibs.jsp" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="${ctx}/static/lib/layui/css/layui.css">
<style type="text/css">
.main_div{
	margin : 15px;
}
</style>
</head>
<body>
	<div class="main_div">
		<form id="from_add" class="layui-form layui-form-pane" action="">
		  <input type="hidden" id="id" name="id" value="${saleChance.id}">
		  <div class="layui-form-item">
		    <label class="layui-form-label">机会来源</label>
		    <div class="layui-input-inline">
		      <input type="text" value="${saleChance.chanceSource}" name="chanceSource" autocomplete="off" value="" placeholder="请输入" class="layui-input">
		    </div>
		  </div>
		  
		  <div class="layui-form-item">
		    <label class="layui-form-label">更改客户</label>
		    <div class="layui-input-inline">
		      <select id="customerId" name="customerId" lay-verify="">
				  <option value="">请修改</option>
			      <c:forEach items="${customers}" var="cus">
					  <option value="${cus.id}">${cus.name}</option>
			      </c:forEach>
			 </select>
		    </div>
		  </div>
		  
		  <div class="layui-form-item">
		    <label class="layui-form-label">意向产品</label>
		    <div class="layui-input-inline">
		      <select id="productId" name="productId" lay-verify="">
				  <option value="">请修改</option>
			      <c:forEach items="${product}" var="pro">
					  <option value="${pro.id}">${pro.name}</option>
			      </c:forEach>
			  </select>
		    </div>
		  </div>
		  
		  <div class="layui-form-item">
		    <label class="layui-form-label">营销人员</label>
		    <div class="layui-input-inline">
		    	<select id="userId" name="userId" lay-verify="">
				  <option value="">请修改</option>
			      <c:forEach items="${user}" var="user">
					  <option value="${user.id}">${user.name}</option>
			      </c:forEach>
			    </select>
		    </div>
		  </div>
		  
		  <div class="layui-form-item">
		    <label class="layui-form-label">成功几率</label>
		    <div class="layui-input-inline">
		      <input type="text" value="${saleChance.successRate}" name="successRate" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
		    </div>
		  </div>
		  
		  <div class="layui-form-item">
		    <label class="layui-form-label">机会描述</label>
		    <div class="layui-input-inline">
		      <input type="text" value="${saleChance.description}" name="description" lay-verify="required" placeholder="请输入" autocomplete="off" class="layui-input">
		    </div>
		  </div>
		  
		  <div class="layui-form-item">
		    <label class="layui-form-label">分配状态</label>
		    <div class="layui-input-inline">
		    	<select id="status" name="status" lay-verify="">
				  <option value="">分配状态</option>
				  <option value="0">未分配</option>
				  <option value="1">已分配</option>
				 </select>
		    </div>
		  </div>
		  <div class="layui-form-item">
		    <label class="layui-form-label">客户开发状态</label>
		    <div class="layui-input-inline">
		    	<select id="devResult" name="devResult" lay-verify="">
				  <option value="">客户开发状态</option>
				  <option value="0">未开发</option>
				  <option value="1">开发中</option>
				  <option value="2">开发成功</option>
				  <option value="3">开发失败</option>
				</select>     
		    </div>
		  </div>
		  
		</form>
		  <button class="layui-btn" onclick="submitForm()">修改</button>
	</div>
	
	
	<script src="${ctx}/static/back/js/jquery.min.js?v=2.1.4"></script>
	<script src="${ctx}/static/common/mylayer.js"></script>
	<script src="${ctx}/static/common/util.js"></script>
	<script src="${ctx}/static/lib/layui/layui.js"></script>
	<script type="text/javascript">
		layui.use(['form', 'upload','layer'], function(){ //from表单，上传文件需要的
		  var form = layui.form;
		  var layer = layui.layer;		
		});
		
		//ajax提交表单
		function submitForm(){
			$.ajax({
				url : "${ctx}/saleChance/update.action",
				data : $('#from_add').serialize(),
				type : "post",
				dataType : "json",	
				success : function(resp){
					if(resp.code == util.SUCCESS){
						mylayer.confirm("修改成功,是否跳转销售机会列表界面？", "${ctx}/saleChance/getSaleChancePage.action");
					} else {
						mylayer.errorMsg(resp.msg);
					}
				}
				
			});
		}
	</script>
	
</body>
</html>